home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Embed / Sources / EmbedPxy.cpp < prev    next >
Encoding:
Text File  |  1995-11-08  |  3.3 KB  |  131 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                EmbedPxy.cpp
  4. //    Release Version:    $ 1.0d11 $ 
  5. //
  6. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "Embed.hpp"
  11.  
  12. // ----- Embed Part Includes -----
  13.  
  14. #ifndef EMBEDPROXY_H
  15. #include "EmbedPxy.h"
  16. #endif
  17.  
  18. #ifndef EMBEDPART_H
  19. #include "EmbedPar.h"
  20. #endif
  21.  
  22. // ----- ODF Includes -----
  23.  
  24. #ifndef FWFRMING_H
  25. #include "FWFrming.h"
  26. #endif
  27.  
  28. #ifndef FWUTIL_H
  29. #include "FWUtil.h"
  30. #endif
  31.  
  32. #ifndef FWPRESEN_H
  33. #include "FWPresen.h"
  34. #endif
  35.  
  36. #ifndef FWFCTCLP_H
  37. #include "FWFctClp.h"
  38. #endif
  39.  
  40. // ----- OS Layer -----
  41.  
  42. #ifndef FWODGEOM_H
  43. #include "FWODGeom.h"
  44. #endif
  45.  
  46. // ----- OpenDoc Includes -----
  47.  
  48. #ifndef SOM_ODShape_xh
  49. #include <Shape.xh>
  50. #endif
  51.  
  52. #ifndef SOM_ODTransform_xh
  53. #include <Trnsform.xh>
  54. #endif
  55.  
  56. #ifndef SOM_ODSession_xh
  57. #include <ODSessn.xh>
  58. #endif
  59.  
  60. //========================================================================================
  61. // RunTime Info
  62. //========================================================================================
  63.  
  64. #ifdef FW_BUILD_MAC
  65. #pragma segment odfembed
  66. #endif
  67.  
  68. //========================================================================================
  69. //    class CEmbedProxy
  70. //========================================================================================
  71.  
  72. //----------------------------------------------------------------------------------------
  73. //    CEmbedProxy constructors
  74. //----------------------------------------------------------------------------------------
  75.  
  76. CEmbedProxy::CEmbedProxy(Environment* ev, CEmbedPart* part) :
  77.     FW_MProxy(ev, part, part->GetMainPresentation(ev)),
  78.     fPart(part)
  79. {
  80. }
  81.  
  82. //----------------------------------------------------------------------------------------
  83. //    CEmbedProxy::~CEmbedProxy
  84. //----------------------------------------------------------------------------------------
  85.  
  86. CEmbedProxy::~CEmbedProxy()
  87. {
  88. }
  89.  
  90. //----------------------------------------------------------------------------------------
  91. //    CEmbedProxy::UsedShapeChanged
  92. //----------------------------------------------------------------------------------------
  93. //    Used shape of an embedded frame changed. Just invalidate 
  94.  
  95. void CEmbedProxy::UsedShapeChanged(Environment* ev,
  96.                                    FW_CEmbeddingFrame* embeddingFrame,
  97.                                    ODFrame* odEmbeddedFrame)
  98. {
  99. FW_UNUSED(odEmbeddedFrame);
  100.  
  101.     embeddingFrame->Invalidate(ev);
  102.  
  103.     // ----- Recalculate the clip -----
  104.     FW_CFacetClipper clipper(ev, fPart);
  105.     clipper.Clip(ev, embeddingFrame);
  106. }
  107.  
  108. //----------------------------------------------------------------------------------------
  109. //    CEmbedProxy::FrameShapeRequested
  110. //----------------------------------------------------------------------------------------
  111. //    We always want the embedded frame to have our frame shape
  112.  
  113. ODShape* CEmbedProxy::FrameShapeRequested(Environment* ev, 
  114.                                         ODFrame* odEmbeddedFrame, 
  115.                                         ODShape* askedFrameShape)
  116. {
  117. FW_UNUSED(askedFrameShape);
  118.  
  119.     FW_CRect rect;
  120.     
  121.     FW_CAcquiredODFrame aqContainingFrame = odEmbeddedFrame->AcquireContainingFrame(ev);
  122.     FW_CEmbeddingFrame* embeddingFrame = FW_CEmbeddingFrame::ODtoFWEmbeddingFrame(ev, aqContainingFrame);
  123.     
  124.     rect = embeddingFrame->GetBounds(ev);
  125.     
  126.     ODShape* frameShape = ::FW_NewODShape(ev, rect);    // No FW_CAcquiredODShape because we are returning it
  127.     return frameShape;
  128. }
  129.  
  130.  
  131.